' VBScript source code
	on error resume next
		class MenuClass
			public MenuItemLength,isShow
			private menuIndex
			public FontFace,oldSelected
			public FontSize,mouseOverColor
			private MenuTable
			Private sub Class_Initialize()
				MenuItemLength=0
				FontSize=12
				mouseOverColor="#003399"
				oldSelected=null
				menuCount=menuCount+1
				isSHow=false
				call CreateMenuLay()
				set MenuTable=document.getElementByID("MenuTable_"&menuCount)
			End Sub
			
			sub CreateMenuLay()
				document.write("<div id=MenuDiv style=""z-index:100;position:absolute;display=none"">")
				document.write("<table id=MenuTable_"&menuCount&" align=left cellpadding=0 cellspacing=3  bgcolor=buttonface style=""cursor:default; border-top:2px solid buttonhighlight; border-left:2px solid buttonhighlight; border-right:2px solid buttonshadow; border-bottom:2px solid buttonshadow; "">")
				document.write("</table></div>")
			End Sub
			sub AddMenuItem(sMenuStr,exeStr,image,tiptext)
				set newRow=MenuTable.insertRow()
		'		newRow.onMouseOver=GetRef("")
				set newCell=newRow.insertCell()
				newCell.style.fontFamily=FontFace
				newCell.style.fontSize=FontSize
				newCell.style.textalign="Left"
				newCell.title=tiptext
				newCell.onClick=GetRef("HideMenu")
				if sMenuStr<>"<hr>" then
					newCell.innerHTML="<font  onmouseover="+chr(34)+"vbscript:SetSelectedMenuColor()"+chr(34)+" onclick="+exeStr+">"+"&nbsp;&nbsp;"+sMenuStr+"&nbsp;&nbsp; "+"</font>"
					call newCell.setAttribute("isHrMenu",false)
				else
					newCell.style.height="1"
					newCell.innerHTML="<hr width=90%>"
					call newCell.setAttribute("isHrMenu",true)
				end if
				newCell.style.textalign="left"
				if image<>"" then
					newCell.innerHTML="<img src="&image&" >"&newCell.innerHTML
				end if
			end sub
			sub ClearMenuItem()
				l=MenuTable.Rows.length-1
				dim j
				for j=0 to l
					MenuTable.deleteRow(0)
				next
			end sub
			
			sub ShowMenu(xPos,yPos)
				call HideMenu()
				dim X,Y,MenuDiv
				X=0
				Y=0
				if window.event.srcElement.tagName<>"BODY" then
					set tempob=window.event.srcElement
					do while 1
						X=X+tempob.offsetLeft
						Y=Y+tempob.offsetTop
						set tempob=tempob.offsetParent
						if tempob.tagName="BODY" then
							exit do
						end if
					loop
				end if
				X=X+window.event.offsetX
				Y=Y+window.event.offsetY
				
				set MenuDiv=MenuTable.parentElement
				MenuDiv.style.display="inline"
			'	ss=document.body.clientWidth&"--"&X&"----"&MenuDiv.offsetWidth
				if document.body.clientWidth-X<MenuDiv.offsetWidth then
					X=document.body.clientWidth-MenuDiv.offsetWidth-document.body.rightmargin-10
				end if
			'	status=ss&"-->:X"&X
				if document.body.clientHeight-Y<MenuDiv.offsetHeight then
					Y=Y-MenuDiv.offsetHeight
				end if			
				MenuDiv.style.left=X
				MenuDiv.style.top=Y
				isShow=True
			end sub
		end class
		sub HideMenu()
			dim MenuDiv,menus
			dim i
			for i=1 to menuCount
				set MenuDiv=document.all("MenuTable_"&i).parentElement
				MenuDiv.style.display="none"
			next
			isShow=False
			oldSelcted=null
			if isobject(curSelected) then
				curSelected.style.backgroundcolor="buttonface"
				curSelected.style.color="black"
			end if
		end sub
		sub SetSelectedMenuColor()
			on error resume next
			set obj=window.event.srcElement.parentElement
			if obj.isHrMenu=true then exit sub
			if isobject(oldSelected) then
				oldSelected.style.backgroundcolor="buttonface"
				oldSelected.style.color="black"
			end if
			obj.style.backgroundColor="#003399"
			obj.style.Color="#ffffff"
			set curSelected=obj
			set oldSelected=obj
		end sub
		sub document_onclick
			HideMenu()
		end sub
		sub document_onKeyPress
			if window.event.keyCode=47 then
				window.open "view-source:" + document.location
			end if
		end sub
		dim oldSelected
		dim curSelected
		dim menuCount
		dim SelectedCard
		menuCount=0
		oldSelected=null
		curSelected=null
		SelectedCard=null
	
